home *** CD-ROM | disk | FTP | other *** search
- 'This file replaces the ADDSHAREIFNEEDED in the Setup1.BAS file
- 'This enables the install program to insert the "C:\DOS\SHARE.EXE /L:500"
- 'into the BEGGINING of an AUTOEXEC.BAT (If placed at the end it MAY come after
- 'a WIN.COM statement (oops, this wouldn't work too well) So... My partner and I
- 'after hours of arquing came up with this answer. It's not glamorous... but it works.
- 'Peace, James Wj Snyder & Dave Murdoch 1994
-
-
- Sub AddShareIfNeeded (SharePath$, ShareFile$)
- On Error GoTo ShareError
- Dim str1 As String
- str1 = "C:\DOS\SHARE.EXE /L:500"
-
- fh% = FreeFile
- Open "C:\AUTOEXEC.BAT" For Input As fh%
- fFound% = 0
- While fFound% Or EOF(fh%)
- Line Input #fh%, Temp1$
- If InStr(1, UCase$(Temp1$), "REM") = 0 And InStr(1, Temp1$, ";") = 0 And InStr(1, UCase$(Temp1$), "SHARE") > 0 Then
- fFound% = True
- End If
- Wend
-
- If fFound% = False Then
- Message% = MsgBox("SHARE.EXE is needed in your AUTOEXEC.BAT - Would you like to have this done automatically?", 36, "Update AUTOEXEC?")
- If Message% = 7 Then
- MsgBox "SHARE.EXE, VSHARE.386, Windows for Workgroups, or Windows95 is needed for this program.", 64, "SHARE NEEDED"
- Exit Sub
- End If
- End If
-
- On Error GoTo ErrHandler
- Close '#fh%
- FileCopy "c:\AUTOEXEC.BAT", "C:\AUTOEXEC.SRS" ' Copy first file
-
-
- '-------------------------------------------------------------------
- On Error Resume Next
- Kill "C:\AUTOEXEC.TMP" 'This deletes a POSSABLE earlier version named this way
-
- On Error Resume Next
- Kill "C:\AUTOEXEC.SRS"
- Open "C:\AUTOEXEC.BAT" For Input As fh%
- fh3% = FreeFile
- Open "C:\AUTOEXEC.TMP" For Append As fh3%
-
- Print #fh3%, str1
- While Not EOF(fh%)
- Line Input #fh%, Temp1$
- Print #fh3%, Temp1$
- Wend
-
- Close
-
-
- FileCopy "c:\autoexec.tmp", "c:\AUTOEXEC.BAT" ' Copy file to destination.
- Message% = MsgBox("Your original AUTOEXEC.BAT file has been copied to AUTOEXEC.SRS.", 16, "INFORMATION")
- Message% = MsgBox("To Run AudioBase you need to reboot your computer first.", 16, "REBOOT SYSTEM")
-
- 'Clean up after ourselves
- Kill "C:\AUTOEXEC.TMP"
-
- Exit Sub
-
-
-
- ShareError:
- Close #fh%, #fh2%, #fh3%
- Exit Sub
- ErrHandler:
- If Err = 55 Then ' File already open.
- MsgBox "Cannot copy an open file. Close it and try again."
- End If
- Resume Next
- End Sub
-